package com.spa.interfaces.admin;

import com.spa.application.dto.admin.IndexDTO;
import com.spa.application.dto.admin.IndexStatisticDTO;
import com.spa.application.query.admin.IndexStatisticQuery;
import com.spa.application.service.admin.AdminIndexService;
import com.spa.infrastructure.common.ResponseMessage;
import com.spa.interfaces.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/index")
public class AdminIndexController extends BaseController {

    @Autowired
    private AdminIndexService adminIndexService;

    @PostMapping
    public ResponseMessage<IndexDTO> index() {
        return responseHelper.success(adminIndexService.index());
    }

    @PostMapping("indexStatistic")
    public ResponseMessage<IndexStatisticDTO> indexStatistic(@RequestBody IndexStatisticQuery query) {
        return responseHelper.success(adminIndexService.indexStatistic(query));
    }

}
